<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="commontaglib"%>
<%
String path = request.getContextPath();

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
 
<html>
  <head>
    <link rel="stylesheet" href="<%=path%>/css/innerstyle.css" type="text/css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<%=path%>/css/cupertino/jquery-ui.custom.min.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<%=path%>/css/ui.jqgrid.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<%=path%>/css/ui.multiselect.css" />
    <script type="text/javascript" src="<%=path%>/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="<%=path%>/js/jquery-ui.custom.min.js"></script>  
    <script type="text/javascript" src="<%=path%>/js/i18n/grid.locale-cn.js"></script> 
    <script type="text/javascript" src="<%=path%>/js/jquery.jqGrid.min.js"></script>
    <script type="text/javascript" src="<%=path%>/js/i18n/jquery.ui.datepicker-zh-CN.js"></script>
    <style>
html, body {
	margin: 0;			 
	padding: 0;
    font-size: 85%;
}
</style>
    
  </head>
  
  <script type="text/javascript">  
  var qieye = 0;

    $(function(){ 
    $("#chax").button();
    $("#reset").button();
    loadTab(0);    
    queryNum();  
    $( "#tabs" ).tabs({
		    select: function(event, ui) {
		    var i =ui.index;	    
		    if(i==''){
		    i="0";
		    }
		    qieye = i;
		    loadTab(i);
		    queryNum();
		    //$("#myTab"+qieye).jqGrid('setGridParam',{url:'htJqgrid.action?index='+qieye,mtype:'post',page:1}).trigger("reloadGrid");
		   // alert("aa");
		     
            //return false;           
  		  }
		
	});
    
 });
 
 function loadTab(i){  
    var sign = true;
    if(i=='1') sign = false;
    $("#myTab"+i).jqGrid({      
    url:'findBbNoteJgrid.action?bblx=3&index='+i, 
    datatype: 'json',
    mtype: 'post',         
   	colNames:['上报月份','地市', '出省累计份数','出省累计运量','出省本月份数','出省本月运量','省内累计份数','省内累计运量','省内本月份数','省内本月运量','电煤累计份数','电煤累计运量','电煤本月份数','电煤本月运量'],
   	colModel:[ 
   	    {name:'sbrq',index:'sbrq', width:80},	  		
   		{name:'dishi',index:'dishi', width:60},
   		{name:'csljfs',index:'csljfs', width:60},
   		{name:'csljyl',index:'csljyl', width:60},
   		{name:'csbyfs',index:'csbyfs', width:60},
   		{name:'csbyyl',index:'csbyyl', width:60},   		
   		{name:'snljfs',index:'snljfs', width:60},
   		{name:'snljyl',index:'snljyl', width:60},
   		{name:'snbyfs',index:'snbyfs', width:60},
   		{name:'snbyyl',index:'snbyyl', width:60},   		
   		{name:'dmljfs',index:'dmljfs', width:60},
   		{name:'dmljyl',index:'dmljyl', width:60},
   		{name:'dmbyfs',index:'dmbyfs', width:60},
   		{name:'dmbyyl',index:'dmbyyl', width:60}		
   	],
   
    jsonReader: {
           repeatitems : false, 
           id: 'hetbh'
         },
    width: 1070, 
    shrinkToFit:false,    	
   	rowNum:10,
   	rowList:[10,20,30],     	
   	pager: '#pager'+i,   	
   	rownumbers: true,   	 
    viewrecords: true,
    multiselect: sign,
    sortorder: 'desc',  
    altRows:true  
	//caption: "合同列表",
	 	
  });
  $("#myTab"+i).jqGrid('setGridHeight','300px');
  }

// 查询
function search(){ 
  //alert("aaa");  
  var formdata = $("#form1").serialize();  
  $("#myTab"+qieye).jqGrid('setGridParam',{url:'findBbNoteJgrid.action?'+formdata+'&index='+qieye,mtype:'post',page:1}).trigger("reloadGrid"); 
}

function openwindow(url){
    var sheight = screen.height-70;
    var swidth = screen.width-10;
   var winoption ="dialogHeight:"+sheight+"px;dialogWidth:"+ swidth +"px;status:yes;scroll:yes;resizable:yes;center:yes";
    var result=window.showModalDialog(url,window,winoption);
    //alert(result);
    if(result ==1){
     reloadhtxx();
      }
    return result;  
}


//重置
function resetSearch(){
	$('#list_search  input[type=text]').val('');
	$('#list_search select').val('-1');
}

function queryNum(){   
			  var formdata = $("#form1").serialize(); 
			  //alert(formdata);
			  $.post("<%=path%>/bbgl/queryNumForCxtj.action?bblx=3&index="+qieye+"&",formdata,function(data,textStatus)
			  {
			  
			  var json = eval('(' + data + ')');
			
			  var re=/(\d{1,3})(?=(\d{3})+(?:$|\.))/g;
	if (json[0].zongsl !="")
{
			   $("#queryNum").html("出省累计份数："+json[0].csljfs.toString().replace(re,"$1,") + "份  出省累计运量："+json[0].csljyl.toString().replace(re,"$1,")+"吨  出省本月份数："+json[0].csbyfs.toString().replace(re,"$1,")+"份  出省本月运量："+json[0].csbyyl.toString().replace(re,"$1,")+"吨  <br>省内累计份数："+json[0].snljfs.toString().replace(re,"$1,") + "份  省内累计运量："+json[0].snljyl.toString().replace(re,"$1,")+"吨  省内本月份数："+json[0].snbyfs.toString().replace(re,"$1,")+"份  省内本月运量："+json[0].snbyyl.toString().replace(re,"$1,")+"吨 <br>电煤累计份数："+json[0].dmljfs.toString().replace(re,"$1,") + "份  电煤累计运量："+json[0].dmljyl.toString().replace(re,"$1,")+"吨  电煤本月份数："+json[0].dmbyfs.toString().replace(re,"$1,")+"份  电煤本月运量："+json[0].dmbyyl.toString().replace(re,"$1,")+"吨");
			} else{
			   $("#queryNum").html("合计 单数：0 条  签订量： 0 万吨  本月执行量：0 万吨 累计执行量：0 万吨");
			 } });
  
 }

function dc_excel(){ 
var a = 0;
if (qieye!="0") a= "1,2,3,4,5";
	form1.action="<%=path%>/htgl/jytj_excel.action?jiaoylx=3&index="+a;
	form1.method = "post";
	form1.submit();
	}

</script>  
<body>  
<div id="best1">
<p></p>
<form id="form1" method="post">

<table id="list_search" cellpadding="0" cellspacing="0" border="0"> 
         
          <tr>
        <td>上报月份:</td>
            <td>
            	<input id="datepicker" type="text" class="textboxs" name="bean.AA" /> -- <input id="datepicker1" type="text" class="textboxs" name="bean.BB" />
            </td>
        <td>地市:</td>
        <td>
        <input type="text" class="longtextbox" name="bean.CC" />
        </td>
        <td>&nbsp;</td>
            <td>
            	&nbsp;
            </td>
        </tr>      
		
  </table> 
  </form>   
    <table id="list_search" cellpadding="0" cellspacing="0" border="0">
    
            <td align="right">
            <input id="chax" type="button" value="查询" onclick="search();"/>
            <input id="reset" type="button" value="重置" onclick="resetSearch();"/>
            </td>
            
        </tr>
    </table> 
    <table id="list_search" cellpadding="0" cellspacing="0" border="0">    
     <ul>
            <li id="queryNum"  style="float:left; vertical-align: bottom; line-height:20px; top: 3px;"></li>
    </ul>
    </table>       
   <div id="tabs">            
			<ul>
				<li><a href="#tabs-0">待提报</a></li>
				<li><a href="#tabs-1">已提报</a></li>				
			</ul>
			<div id="tabs-0">
				<table id="myTab0" class="scroll" cellpadding="0" cellspacing="0"></table>
				<div id="pager0" class="scroll"></div>
				<div id="message0" class="scroll"></div>
			</div>
			<div id="tabs-1">
				<table id="myTab1" class="scroll" cellpadding="0" cellspacing="0"></table>
				<div id="pager1" class="scroll"></div>
				<div id="message1" class="scroll"></div>
			</div>

   </div>   
</div> 
</body>
</html>
